package com.woniuedu.search.config;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfiguration {
    /**
     * 路由模式
     */
    @Bean
    public Queue directQueueA(){
        return new Queue("direct_amd");
    }
    @Bean
    public Queue directQueueB(){
        return new Queue("direct_del");
    }
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("direct_exchange");
    }
    @Bean
    public Binding bindingDirectQueueAToDirectExchange(Queue directQueueA,DirectExchange directExchange){
        return BindingBuilder.bind(directQueueA).to(directExchange).with("amd");
    }
    @Bean
    public Binding bindingDirectQueueBToDirectExchange(Queue directQueueB,DirectExchange directExchange){
        return BindingBuilder.bind(directQueueB).to(directExchange).with("del");
    }
}
